package com.ktjy.config;

import com.ktjy.entity.SysRole;
import com.ktjy.entity.SysUser;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource(value = "classpath:user.properties",encoding = "utf-8")
public class JavaConfig {

    @Value("${user.realName}")
    private String realName;
    @Value("${user.account}")
    private String account;

    @Bean
    public SysUser sysUser(SysRole sysRole) {
        SysUser sysUser = new SysUser();
        sysUser.setRealName("傻琦");
        sysUser.setAccount("111111");
        sysUser.setSysRole(sysRole);
        return sysUser;
    }

    @Bean
    public SysRole sysRole() {
        SysRole sysRole = new SysRole();
        sysRole.setRoleName("厕所长");
        return sysRole;
    }
}
